'use client'

import { createClient } from '@/utils/supabase/client'

import { Button } from '../ui/button'

export default function SignUp({ id }: { id: string }) {
  const supabase = createClient()

  const handleSignUp = async () => {
    const { data, error } = await supabase
      .from('user')
      .update({ status: 1 })
      .eq('id', id)

    if (error) {
      return
    }

    window.location.reload()
  }

  return (
    <div>
      <h1>已登录未注册</h1>
      <Button onClick={handleSignUp}>注册</Button>
    </div>
  )
}
